package com.onec.service.route.entity;


import com.onec.service.api.content.AesEntityContent;
import com.onec.service.api.enums.SystemTypeEnum;
import lombok.Data;
import org.hibernate.annotations.ColumnTransformer;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 代理商业务限制：
 *
 * @author ONEC
 */
@Data
@Entity
@Table(name = "t_agent_limit_info")
public class AgentLimitInfo implements Serializable {


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true)
    private Long id;

    /**
     * 机构编号
     */
    @Column(name = "agent_code", length = 16)
    private String agentCode;
    /**
     * 敏感信息
     */
    @Column(name = "value", length = 128)
    @ColumnTransformer(
            read = AesEntityContent.AES_DECRYPT_VALUE,
            write = AesEntityContent.AES_ENCRYPT_VALUE
    )
    private String value;
    /**
     * 限制类型：表示那种限额：redis 配置限额：持久化到数据库：
     */
    @Column(name = "type", length = 8)
    @Enumerated(EnumType.STRING)
    private SystemTypeEnum type;
    /**
     * 注册数：
     */
    @Column(name = "size", length = 8)
    private Integer size;
    /**
     * 注册数：
     */
    @Column(name = "total_size")
    private Integer totalSize;

    @Column(name = "create_time")
    @CreatedDate
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;

    @Column(name = "update_time")
    @LastModifiedDate
    @Temporal(TemporalType.TIMESTAMP)
    private Date updateTime;


}
